package com.example.vo;

import java.util.Date;

public class Student {//创建一个由Spring管理的类
    //Spring创建对象的方法
    //1. 构造方法   前提:一定要包含一个无参的构造方法
    private String sname;
    private int age;


    public Student(String sname, int age) {
        this.sname = sname;
        this.age = age;
    }

    public Student() {
    }
    private Date birthday;

    //2.使用指定方法赋值
    public void init(){ //使用自定义的方法 赋值
        this.sname = "李四";
    }

    @Override
    public String toString() {
        return "Student{" +
                "sname='" + sname + '\'' +
                ", age=" + age +
                ", birthday=" + birthday +
                '}';
    }
    //3.使用set方法
    public void setSname(String sname) {
        this.sname = sname;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
